using System.Collections.Generic;
using System.Web;

namespace Jaws.Core.Web.Extensions.Properties
{
    public static class Session
    {

        public static T GetSessionProperty<T>(this object property)
        {

            string name = property.GetType().Name;
            if (HttpContext.Current.Session[name] != null)
            {
                return (T)HttpContext.Current.Session[name];
            }
            HttpContext.Current.Session[name] = new object();
            return (T)HttpContext.Current.Session[name];
        }

        public static T SetSessionProperty<T>(this object property, object value)
        {
            string name = property.ToString();
            if (HttpContext.Current.Session[name] != null)
            {
                return (T)HttpContext.Current.Session[name];
            }
            HttpContext.Current.Session[name] = new object();
            return (T)HttpContext.Current.Session[name];
        }
    }

    public class Whatever
    {
        private string sampleText;

        public Whatever()
        {
            sampleText = "test";
            sampleText.GetSessionProperty<List<string>>().Add("");

        }
    }
}